using System;
using System.Collections.Generic;

namespace StackCalc.Instructions
{
	public class ReadInstruction : IInstruction
	{
		public void Execute(List<IInstruction> stack, StackEngine stackEngine)
		{
			stackEngine.InvokeReadEvent(new EventArgs<Action<string>>(s => stack.Add(new BracedExpression(s))));
		}

		public string Validate(List<IInstruction> stack)
		{
			// read is always possible
			return string.Empty;
		}
	}
}